package com.wechat.service.account.starter.customMenu;

import com.alibaba.fastjson.JSONObject;
import com.wechat.service.account.starter.BaseWechatService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

/**
 * @Author yanggld
 * @Date 2019/7/12-17:45
 * @Description
 * 获取自定义菜单配置接口
 */
@Service
public class SelfMenuInfoService extends BaseWechatService {

	/**
	 * 获取自定义菜单配置接口
	 * @return
	 */
	public JSONObject getCurrentSelfMenuInfo(){
		ResponseEntity<JSONObject> responseEntity = restTemplate.getForEntity(buildCurrentSelfMenuInfoUrl(), JSONObject.class);
		return responseEntity.getBody();
	}

	public String buildCurrentSelfMenuInfoUrl(){
		return "https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token="+accessTokenService.getAccessToken();
	}
}
